package com.insigma.business.qrcode.common.util;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

public class LogUtil {

    
    private LogUtil() {
    }

    
    public static void debug(final Logger logger, final Object... objArray) {
        logger.debug("{}", getLogString(objArray));
    }

    
    public static void info(final Logger logger, final Object... objArray) {
        logger.info("{}", getLogString(objArray));
    }

    
    public static void warn(final Logger logger, final Object... objArray) {
        logger.warn("{}", getLogString(objArray));
    }

    
    static String getLogString(final Object... objArray) {
        if(ArrayUtils.isEmpty(objArray)) {
            return StringUtils.EMPTY;
        }

        final StringBuilder stringBuilder = new StringBuilder();
        for (Object obj : objArray) {
            stringBuilder.append(obj);
        }

        return stringBuilder.toString();
    }
}
